﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

public partial class ybqy_print_1_11 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack) { return; }

        SqlConnection sqlcon = new SqlConnection();
        sqlcon.ConnectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
        sqlcon.Open();

        SqlCommand sqlcmd = new SqlCommand("select a.*,b.* from a01111_2 a,CODE_POLLUTION_TABLE b where a.POLLUTE_CODE=b.code and a.SERIAL='5100' and a.ShenBaoNianDu='" + Session["ShenBaoNianDu"] + "' and a.qiyeid=" + Session["qiyeid"] + " order by a.id", sqlcon);

        SqlDataReader reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);

        int i = 1;
        while (reader.Read())
        {
            if (i == 1)
            {
                POLLUTE_CODE1.Text = reader["name"].ToString();
                PERMIT_VALUE1.Text = reader["PERMIT_VALUE"].ToString();
                MAX_DENSITY1.Text = reader["MAX_DENSITY"].ToString();
            }
            if (i == 2)
            {
                POLLUTE_CODE2.Text = reader["name"].ToString();
                PERMIT_VALUE2.Text = reader["PERMIT_VALUE"].ToString();
                MAX_DENSITY2.Text = reader["MAX_DENSITY"].ToString();
            }
            if (i == 3)
            {
                POLLUTE_CODE3.Text = reader["name"].ToString();
                PERMIT_VALUE3.Text = reader["PERMIT_VALUE"].ToString();
                MAX_DENSITY3.Text = reader["MAX_DENSITY"].ToString();
            }
            if (i == 4)
            {
                POLLUTE_CODE4.Text = reader["name"].ToString();
                PERMIT_VALUE4.Text = reader["PERMIT_VALUE"].ToString();
                MAX_DENSITY4.Text = reader["MAX_DENSITY"].ToString();
            }
            i = i + 1;
        }
        sqlcmd.CommandText = "select a.*,b.* from a01111_2 a,CODE_POLLUTION_TABLE b where a.POLLUTE_CODE=b.code and a.SERIAL='5200' and a.ShenBaoNianDu='" + Session["ShenBaoNianDu"] + "' and a.qiyeid=" + Session["qiyeid"] + " order by a.id";

        reader.Close();
        sqlcon.Open();
        reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);

        i = 1;
        while (reader.Read())
        {
            if (i == 1)
            {
                POLLUTE_CODE5.Text = reader["name"].ToString();
                PERMIT_VALUE5.Text = reader["PERMIT_VALUE"].ToString();
                MAX_DENSITY5.Text = reader["MAX_DENSITY"].ToString();
            }
            if (i == 2)
            {
                POLLUTE_CODE6.Text = reader["name"].ToString();
                PERMIT_VALUE6.Text = reader["PERMIT_VALUE"].ToString();
                MAX_DENSITY6.Text = reader["MAX_DENSITY"].ToString();
            }
            if (i == 3)
            {
                POLLUTE_CODE7.Text = reader["name"].ToString();
                PERMIT_VALUE7.Text = reader["PERMIT_VALUE"].ToString();
                MAX_DENSITY7.Text = reader["MAX_DENSITY"].ToString();
            }
            if (i == 4)
            {
                POLLUTE_CODE8.Text = reader["name"].ToString();
                PERMIT_VALUE8.Text = reader["PERMIT_VALUE"].ToString();
                MAX_DENSITY8.Text = reader["MAX_DENSITY"].ToString();
            }
            i = i + 1;
        }
        sqlcmd.CommandText = "select * from a01111_1 where SERIAL='5100' and ShenBaoNianDu='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];

        reader.Close();
        sqlcon.Open();
        reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);

        if (reader.Read())
        {
            PERMIT_COUNTs.Text = reader["PERMIT_COUNT"].ToString();
        }
        sqlcmd.CommandText = "select * from a01111_1 where SERIAL='5200' and ShenBaoNianDu='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];

        reader.Close();
        sqlcon.Open();
        reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);

        if (reader.Read())
        {
            PERMIT_COUNTq.Text = reader["PERMIT_COUNT"].ToString();
        }

    }
}